﻿export default url => {
    const crud = window.$crud(url)
    const customerfollow = (data) => window.$axios({
        url: `erpCase/customerfollow`,
        method: 'post',
        data:data
    })

    const customerfollows = (data) => window.$axios({
        url: `erpCase/customerfollow/page`,
        method: 'get',
        params:data
    })

    // 获取单条跟进记录
    const oneCustomerfollow = (id) => window.$axios({
        url: `erpCase/customerfollow/${id}`,
        method: 'get',
    })

    // Edit跟进记录
    const exitCustomerfollow = (id,data) => window.$axios({
        url: `erpCase/customerfollow/${id}`,
        method: 'put',
        data:data,
    })
    const deleteCustomerfollow = (id,data) => window.$axios({
        url: `erpCase/customerfollow/${id}`,
        method: 'delete',
        data:data,
    })
    // 移入公海
    const transferpublic = (ids) => window.$axios({
        url: `erpCase/customer/transferpublic/${ids}`,
        method: 'put',
    })
    
    // 领取公海用户
    const receivecustomer = (id) => window.$axios({
        url: `erpCase/customer/receivecustomer/${id}`,
        method: 'put',
    })

    // 
    const customerfollowId = (id) => window.$axios({
        url: `erpCase/customerfollow/${id}`,
        method: 'get',
    })
    const customerId = (id) => window.$axios({
        url: `erpCase/customer/${id}`,
        method: 'get',
    })

    // 操作记录
    const logs = (data) => window.$axios({
        url: `erpCase/logs`,
        method: 'get',
        params:data
    })
    return {
        ...crud,
        customerfollow,
        transferpublic,
        customerfollows,
        oneCustomerfollow,
        exitCustomerfollow,
        deleteCustomerfollow,
        receivecustomer,
        customerfollowId,
        customerId,
        logs,
    }
}